﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GestionePolveriLib.Facades;
using GestionePolveriLib.BL;
using Controlslib.Toolstrip;

namespace GestionePolveri2
{
    public partial class ElencoImpiantiEx : UserControl, IHostableControl
    {
        public ElencoImpiantiEx()
        {
            InitializeComponent();

            this.SetTopLevel(true);
        }

        public void Initialize()
        {
            ImpiantoFacade tf = new ImpiantoFacade();

            tf.LoadImpiantoAsync((result) =>
            {
                foreach (Impianto imp in (List<Impianto>)result)
                {
                    ListViewItem item = new ListViewItem(imp.Nome);
                    item.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = (imp.Fittizio ? "F" : "") });
                }
            });
        }

        public event EventHandler<HostableControlEvent> OnEventOccurred;
    }
}
